home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Graphics / sKulpt / skulpt-src / Logo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-28  |  4.0 KB  |  135 lines

  1. #define STRICT
  2.  
  3. // Includes standard Windows
  4. #include <windows.h>
  5. #include <windowsx.h>
  6. #include <time.h>
  7. #include <stdlib.h>
  8. #include <malloc.h>
  9. #include <memory.h>
  10. #include <stdio.h>
  11.  
  12. // Includes D3D
  13. #define  D3D_OVERLOADS
  14. #include <ddraw.h>
  15. #include <d3d.h>
  16. #include <d3dx.h>
  17.  
  18. // Includes utilitaires D3D
  19. #include "d3dmath.h"
  20. #include "d3dutil.h"
  21. #include "D3DEnum.h"
  22.  
  23. // Ids Resources
  24. #include "resource.h"
  25.  
  26. // Constantes
  27. #include "const.h"
  28.  
  29. // Types
  30. #include "types.h"
  31.  
  32. // Variables globales projet
  33. #include "vars.h"
  34.  
  35. // Prototypes fonctions autres modules
  36. #include "proto.h"
  37.  
  38. // Macros
  39. #include "macros.h"
  40.  
  41. LRESULT CALLBACK LogoWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  42. {
  43.     switch( uMsg )
  44.     {
  45.         case WM_LBUTTONDOWN:    
  46.         case WM_MBUTTONDOWN:
  47.         case WM_RBUTTONDOWN:
  48.         case WM_CHAR:
  49.             DestroyWindow( hWnd );
  50.             return 0;
  51.     }
  52.     return DefWindowProc( hWnd, uMsg, wParam, lParam );
  53. }
  54.  
  55. void vLogo(void)
  56. {
  57.     HBITMAP bmLogo;
  58.     HDC hdcLogo;
  59.     HWND hWndLogo, hWndText;
  60.     WNDCLASS wcLogo;
  61.     HGDIOBJ hold;
  62.     RECT rRectangle;
  63.     HDC hdcWork;
  64.     
  65.     // Récupérer les dimensions de l'écran
  66.     hdcWork = GetDC(NULL);
  67.     int iX = GetDeviceCaps(hdcWork, HORZRES),
  68.         iY = GetDeviceCaps(hdcWork, VERTRES);
  69.     ReleaseDC(NULL, hdcWork);
  70.  
  71.     // Charger l'image du logo
  72.     bmLogo = (HBITMAP) LoadImage(hInst, "logo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
  73.  
  74.     wcLogo.style         = CS_SAVEBITS | CS_NOCLOSE;
  75.     wcLogo.lpfnWndProc   = (WNDPROC)LogoWndProc;
  76.     wcLogo.cbClsExtra    = 0;
  77.     wcLogo.cbWndExtra    = 0;
  78.     wcLogo.hInstance     = hInst;
  79.     wcLogo.hIcon         = NULL;
  80.     wcLogo.hCursor       = LoadCursor(NULL, IDC_ARROW);
  81.     wcLogo.hbrBackground = (HBRUSH)(COLOR_WINDOW);
  82.     wcLogo.lpszMenuName  = NULL;
  83.     wcLogo.lpszClassName = sLogo;
  84.     RegisterClass(&wcLogo);
  85.  
  86.     hWndLogo = CreateWindowEx(WS_EX_TOPMOST, sLogo,
  87.                 NULL,
  88.                 WS_POPUP | WS_VISIBLE | WS_DLGFRAME,
  89.                 iX / 2 - (522 / 2), iY / 2 - (261 / 2), 522, 261,
  90.                 NULL, NULL, hInst, NULL);
  91.  
  92.     if (!hWndLogo) return;
  93.  
  94.     // Ajouter la listbox à la fenêtre logo
  95.     GetClientRect(hWndLogo, &rRectangle);
  96.     hWndText = CreateWindow("LISTBOX",
  97.         NULL,
  98.         WS_DISABLED | WS_THICKFRAME | WS_CHILD | WS_VSCROLL | WS_VISIBLE,
  99.         rRectangle.left + 259, rRectangle.top, rRectangle.right - 260, rRectangle.bottom+2,
  100.         hWndLogo, NULL, hInst, NULL);
  101.  
  102.     // Sortir le texte about
  103.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Sculpt \"RenderGirl\" Direct3D");
  104.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Avec des petits bouts de code dedans !!");
  105.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "** Best browzed wiz a Greuh-force **");
  106.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Un sous-clone de l'inimitable & parfait");
  107.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Sculpt 3D (1987) pour Amiga (1985)");
  108.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "En hommage à BYTE by BYTE");
  109.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Et pour le fun du code DX7/D3Dim");
  110.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Code : Sgueu");
  111.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Code additionnel : Tox Teapot'Rahan");
  112.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Idées : Greuh-nouil (comme d'hab)");
  113.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Support : Yeyel Kidz Kat Janal Droid");
  114.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Bugs : Sub'zzzZZZzzzzZZzzz... Paf !");
  115.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Greets : Yoyo, Jojo, CdBS");
  116.     SendMessage(hWndText, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Game & lame : Willy Go Cake !");
  117.     
  118.     hdcWork = GetDC(hWndLogo);
  119.     hdcLogo = CreateCompatibleDC(hdcWork);
  120.     hold = SelectObject(hdcLogo, bmLogo);
  121.  
  122.     BitBlt(hdcWork,0, 0, 256, 256, hdcLogo, 0, 0, SRCCOPY);
  123.  
  124.     ShowWindow(hWndLogo, SW_SHOW);
  125.     UpdateWindow(hWndLogo);
  126.  
  127.     SelectObject(hdcLogo, hold);
  128.     DeleteDC(hdcLogo);
  129.     ReleaseDC(hWndLogo, hdcWork);
  130.  
  131.     UnregisterClass(sLogo, hInst);
  132.     
  133.     DeleteObject(bmLogo);
  134. }
  135.